﻿//----------------------------------------------------------------------------------------------------
// A NodeInstance is the representation of a node in a level
//----------------------------------------------------------------------------------------------------

package HG.Visual
{
	import flash.display.*;
	import flash.events.*;
	import flash.utils.Timer;
	import fl.transitions.Tween;
	import fl.transitions.easing.*;
	import fl.transitions.TweenEvent;
	
	public class VisualTextComplete extends MovieClip
	{
		var m_animTimer:Timer;
		
		//----------------------------------------------------------------------------------------------------
		public function VisualTextComplete()
		{
			m_animTimer = new Timer(0);
			m_animTimer.addEventListener(TimerEvent.TIMER, ShowValue);
			
			Content.alpha = 0;
		}
		
		//----------------------------------------------------------------------------------------------------
		public function SetLabel(labelString:String)
		{
			TXT_Label.text = labelString;
		}

		//----------------------------------------------------------------------------------------------------
		public function SetValue(val:String, delay:Number)
		{
			Content.TXT_Val.text = val;
			
			m_animTimer.reset();
			m_animTimer.delay = delay;
			m_animTimer.start();
		}
		
		//----------------------------------------------------------------------------------------------------
		public function ShowValue(evt:TimerEvent)
		{
			m_animTimer.stop();
	
			new Tween(Content, "alpha", Strong.easeIn, Content.alpha, 1, 0.25, true);
			new Tween(Content, "scaleX", Strong.easeIn, 2, 1, 0.25, true);
			new Tween(Content, "scaleY", Strong.easeIn, 2, 1, 0.25, true);
		}
		
		//----------------------------------------------------------------------------------------------------
	}
}